<template>
  <div>
    <!--轮播图-->
    <el-carousel height="150px">
      <el-carousel-item v-for="item in pics" :key="item.id">
        <img v-bind:src="item.url">
      </el-carousel-item>
    </el-carousel>
    <!--滚动-->
    <ul>
      <li v-for="item in goods" v-bind:key="item.id">
        <ul>
          <li v-for="foods in item.foods"  v-bind:key="foods.id">
            {{foods.name}}<br>
            {{foods.name}}<br>
            {{foods.name}}<br>
            {{foods.name}}<br>
            {{foods.name}}<br>
          </li>
        </ul>
      </li>
    </ul>
  </div>
</template>

<script>
import {mapGetters, mapActions} from 'vuex'
export default {
  name: 'goods',
  data () {
    return {
      pics: [
        {url: require('../../assets/dm.png')},
        {url: require('../../assets/dm2.jpg')},
        {url: require('../../assets/dm3.png')}
      ]
    }
  },
  computed: {
    ...mapGetters(['goods'])
  },
  methods: {
    ...mapActions(['getGoods'])
  },
  created () {
    // eslint-disable-next-line no-unused-vars
    var getGoods = this.getGoods()
  }
}
</script>

<style scoped lang="less">
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
  .el-carousel{
    img{
      width: 100%;
    }
  }
</style>
